﻿@using PNProject.EF;
@{
    ViewBag.Title = "Detail";
    Layout = "~/Views/Shared/_Layout1.cshtml";
    News news = (News)(ViewData["news"]);
    bool lang = (bool)(ViewData["lang"]);
    string langText = lang ? "" : "en-US/";
    List<News> relative = (List<News>)ViewData["relative"];
}

<div class="tebox">
                    	<div class="boxText">
                        	<ul>
                            	<li class="boxTextI">
                                    @{ string avatar = string.IsNullOrEmpty(news.Avatar) ? "/images/default-img.jpg" : news.Avatar;}
                                	<img src="@avatar" alt=""/>
                                    <a href="#">@news.Title</a>
                                    @{ DateTime time = news.CreateDate.HasValue ? news.CreateDate.Value : DateTime.Now;}
                                    <span>@PNProject.PNLibraries.PNTimeFormat(time,false,lang)</span>
                                    <p>@news.Short</p>
                                </li>
                            	<li class="conText">
                                    @Html.Raw(news.ContentVN)
                                </li>
                            </ul>
                        </div>
                        <div class="tinkhac">
                            @if (lang)
                            {
                        	<p>Các tin khác</p>
                            }
                            else
                            {
                                <p>Others</p>
                            }
                            <ul>
                                @foreach (var item in relative)
                                {
                                    DateTime timex = item.CreateDate.HasValue ? item.CreateDate.Value : DateTime.Now;
                                    <li><a href="/@string.Concat(langText, "news/detail/", item.TLink)">@item.Title <span>@PNProject.PNLibraries.PNTimeFormat(timex, false, lang)</span></a></li>
                                }                           	
                                
                            </ul>
                        </div>
                    </div>
                    <script type="text/javascript">
                        $(document).ready(function () {
                            $(".titlesub p").empty();
                            var lang = document.URL.indexOf("en-US") < 0 ? true : false;
                            if (lang) {
                                $(".titlesub p").append("Tin tức & sự kiện");
                                $("#ulink_home a").append("Trang chủ");
                                $("#ulink_child a").append("Tin tức & sự kiện");
                                $("#ulink_child a").attr("href", "/News");
                            }
                            else {
                                $(".titlesub p").append("News & Events");
                                $("#ulink_home a").append("Home");
                                $("#ulink_home a").attr("href", "/en-US/home");
                                $("#ulink_child a").append("News & Events");
                                $("#ulink_child a").attr("href", "/en-US/News");
                            }
                        });
</script>